package com.neusoft.adminweb.service.impl;

import com.github.pagehelper.PageHelper;
import com.neusoft.adminweb.dao.AdminDao;
import com.neusoft.adminweb.entity.Admin;
import com.neusoft.adminweb.service.AdminService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Admin)表服务实现类
 *
 * @author makejava
 * @since 2020-11-09 10:29:09
 */
@Service("adminService")
public class AdminServiceImpl implements AdminService {
    @Resource
    private AdminDao adminDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public Admin queryById(Integer id) {
        return this.adminDao.queryById(id);
    }

    @Override
    public List<Admin> queryPageByArgs(Admin args) {
        return adminDao.queryPageByArgs(args);
    }

    @Override
    public Admin login(String account, String password, Integer type) {
        return adminDao.login(account, password, type);
    }

    /**
     * 新增数据
     *
     * @param admin 实例对象
     * @return 实例对象
     */
    @Override
    public boolean insert(Admin admin) {
        return this.adminDao.insert(admin);
    }

    /**
     * 修改数据
     *
     * @param admin 实例对象
     * @return 实例对象
     */
    @Override
    public boolean update(Admin admin) {
        return this.adminDao.update(admin);
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.adminDao.deleteById(id);
    }
}